home *** CD-ROM | disk | FTP | other *** search
/ Gamers Delight 2 / Gamers Delight 2.iso / Aminet / game / board / IGNUChess151.lha / GNUChess-1.51 / gfx.c < prev    next >
C/C++ Source or Header  |  1994-02-10  |  2KB  |  69 lines

  1. /************************************************************************/
  2. /* "Low-Level" graphics functions                                        */
  3. /************************************************************************/
  4.  
  5. #include <graphics/gfx.h>
  6. #include <graphics/gfxmacros.h>
  7.  
  8. #include <intuition/intuition.h>
  9.  
  10. #include <proto/graphics.h>
  11. #include <proto/intuition.h>
  12.  
  13. #include "global.h"
  14. #include "gfx.h"
  15. #include "gnuchess.h"
  16.  
  17. static void DrawRect(int, int, int, int);
  18.  
  19. void DrawFeld(int Figur, int x, int y)
  20. {
  21.     int off;
  22.  
  23.     switch ( Figur ) {
  24.         case ' ': off =  0; break;
  25.         case 'P': off =  1; break;
  26.         case 'R': off =  2; break;
  27.         case 'N': off =  3; break;
  28.         case 'B': off =  4; break;
  29.         case 'Q': off =  5; break;
  30.         case 'K': off =  6; break;
  31.         case 'p': off =  7; break;
  32.         case 'r': off =  8; break;
  33.         case 'n': off =  9; break;
  34.         case 'b': off = 10; break;
  35.         case 'q': off = 11; break;
  36.         case 'k': off = 12; break;
  37.     }
  38.     if ( ! (ODD(x + y)) ) off += 13;
  39.     DrawImage(rp, Images[off], XPOS(x), YPOS(y));
  40. }
  41.  
  42. void XField(int sq, int col)
  43. {
  44.     int x1, y1;
  45.     
  46.     x1 = XPOS(sq % 8); y1 = YPOS(sq / 8);
  47.     
  48.     SetAPen(rp, col);
  49.     DrawRect(x1 - 2, y1 - 2, x1 + (FELDBREITE - 1), y1 + (FELDHOEHE - 1));
  50.     DrawRect(x1 - 1, y1 - 1, x1 + (FELDBREITE - 2), y1 + (FELDHOEHE - 2));
  51. }
  52.  
  53. static void DrawRect(int x1, int y1, int x2, int y2)
  54. {
  55.     Move(rp, x1, y1);
  56.     Draw(rp, x1, y2);
  57.     Draw(rp, x2, y2);
  58.     Draw(rp, x2, y1);
  59.     Draw(rp, x1, y1);
  60. }
  61.  
  62. void ResetGfx(void)
  63. {
  64.     if ( reverse )
  65.         PrintIText(rp, IText_rev, XOFF - 16, YOFF - 384);
  66.     else
  67.         PrintIText(rp, IText_nor, XOFF - 16, YOFF - 384);
  68. }
  69.